﻿/*
 * Created by SharpDevelop.
 * User: Miguel
 * Date: 16/11/2011
 * Time: 11:54 p.m.
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using Business_Entity;
using Business_Logic;

namespace PetSoft.GUI.Compras
{
	/// <summary>
	/// Description of GUIListaLineaOrdenCompra.
	/// </summary>
	public partial class GUIListaLineaOrdenCompra : Form
	{
		private List<BELineaPedidoAbastecimiento> lstPed;
		private BLPedidoAbastecimiento blPed;
		private int codigo;
		public GUIListaLineaOrdenCompra(int id)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			try{
				InitializeComponent();
				lstPed=new List<BELineaPedidoAbastecimiento>();
				blPed=new BLPedidoAbastecimiento();
				lstPed.AddRange(blPed.getDetalleByCod(id));
				codigo=id;				
			}catch(Exception ex){
				Utils.MessageError("",ex);
			}
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
			
		}
		void CargarTabla(){
			try{
				for (int i=0;i<lstPed.Count;i++){
					BELineaPedidoAbastecimiento bePP=lstPed[i];
	            		ListaOrdenCompraDGV.Rows.Add(new object[] { bePP.Producto.Codigo, bePP.Producto.Nombre,bePP.Producto.Descripcion,
					                             	bePP.Producto.TipoProducto.Descripcion,
					                             	bePP.Proveedor.RazonSocial,bePP.Cantidad});
	            		
				}
				CodigoTB.Text=codigo.ToString();
			}catch(Exception ex){
				Utils.MessageError("",ex);
			}
		}
		void CerrarBTNClick(object sender, EventArgs e)
		{
			try{
				this.Close();
			}catch(Exception ex){
				Utils.MessageError("",ex);
			}
		}
	}
}
